package com.example.demo.service.impl;

import com.example.demo.service.OrderService;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {
    @Override
    public void add(String pname, int number) {
        System.out.println("购买了" + number + "个" + pname);
    }

    @Override
    public void delete(String pname) {
        System.out.println("删除了购物车中的" + pname);
    }

    @Override
    public int find(String pname) {
        // 模拟查询结果，返回随机数量1-10
        int count = (int) (Math.random() * 10) + 1;
        System.out.println("查询" + pname + "的数量为：" + count);
        return count;
    }

}
